home *** CD-ROM | disk | FTP | other *** search
/ MacFormat España 15 / macformat_15.iso / C de cerca / Codewarrior Lite / MacOS Support / Headers / ANSI Headers / unistd.h < prev    next >
Text File  |  1995-12-29  |  3KB  |  138 lines

  1. /*
  2.  *    File:        unistd.h
  3.  *                ©1993-1995 metrowerks Inc. All rights reserved
  4.  *    Author:        Berardino E. Baratta
  5.  *
  6.  *    Content:    Interface file to standard UNIX-style entry points ...
  7.  *
  8.  *    NB:            This file implements some UNIX low level support.  These functions
  9.  *                are not guaranteed to be 100% conformant.
  10.  */
  11.  
  12. #ifndef    _UNISTD
  13. #define    _UNISTD
  14.  
  15. #pragma options align=mac68k
  16.  
  17. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  18. #pragma import on
  19. #endif
  20.  
  21. #ifndef _STDIO
  22.     /* macros for whence parameter of lseek() (taken from <stdio.h> */
  23.     #define SEEK_SET    0
  24.     #define SEEK_CUR    1
  25.     #define SEEK_END    2
  26. #endif
  27.  
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31.  
  32. /*
  33.  *    Change the current directory.
  34.  */
  35. int chdir(const char *path);
  36.  
  37. /*
  38.  *    Closes an open file.
  39.  */
  40. int close(int fildes);
  41.  
  42. /*
  43.  *    Returns the user name associated with the current process.  For the mac we always return
  44.  *    the login name.  If string is not NULL, it must be at least FILENAME_MAX large.
  45.  */
  46. char *cuserid(char *string);
  47.  
  48. /*
  49.  *    Launches the application fname and then quits upon succesful launch.
  50.  *    NB: all exec calls pass through this one call, since argument passing (argc, argv) doesn't
  51.  *        exist for mac applications.
  52.  */
  53. int exec(const char *path, ...);
  54. #define execl            exec
  55. #define execv            exec
  56. #define execle            exec
  57. #define execle            exec
  58. #define execve            exec
  59. #define execlp            exec
  60. #define execvp            exec
  61.  
  62. /*
  63.  *    Get the current directory.
  64.  */
  65. char *getcwd(char *buf, int size);
  66.  
  67. /*
  68.  *    The following UNIX functions don't really have any meaning on the Mac, so we just
  69.  *    return values that would make sense for a typical user process under UNIX ...
  70.  */
  71.  
  72. #define getpid()        ((int) 9000)
  73. #define getppid()        ((int) 8000)
  74. #define getuid()        ((int) 200)
  75. #define geteuid()        ((int) 200)
  76. #define getgid()        ((int) 100)
  77. #define getegid()        ((int) 100)
  78. #define getpgrp()        ((int) 9000)
  79.  
  80. /*
  81.  *    The Mac doesn't have a login, so we just return the Owner Name from the Sharing Setup
  82.  *    Control Panel.
  83.  */
  84. char *getlogin(void);
  85.  
  86. /*
  87.  *    Determines is a specified fileid is attached to the console.
  88.  */
  89. int isatty(int fildes);
  90.  
  91. /*
  92.  *    Seek on a file stream.
  93.  */
  94. long lseek(int fildes, long offset, int whence);
  95.  
  96. /*
  97.  *    Reads from a file stream.
  98.  */
  99. int read(int fildes, char *buf, int count);
  100.  
  101. /*
  102.  *    Delete a directory.
  103.  */
  104. int rmdir(const char *path);
  105.  
  106. /*
  107.  *    Delay program execution for a specified number of seconds.
  108.  */
  109. unsigned int sleep(unsigned int sleep);
  110.  
  111. /*
  112.  *    Returns the name of the terminal associated with the fileid, or NULL if fileid doesn't
  113.  *    specify a terminal.
  114.  */
  115. char *ttyname(int fildes);
  116.  
  117. /*
  118.  *    Unlink (delete) a file.
  119.  */
  120. int unlink(const char *path);
  121.  
  122. /*
  123.  *    Writes to a file stream.
  124.  */
  125. int write(int fildes, const char *buf, int count);
  126.  
  127. #ifdef __cplusplus
  128. }
  129. #endif
  130.  
  131. #if __CFM68K__ && __USING_IMPORTED_ANSI__
  132. #pragma import reset
  133. #endif
  134.  
  135. #pragma options align=reset
  136.  
  137. #endif
  138.